import logging

from config import BASE_HOST


class OpenAccountApi:

    def __init__(self, session):
        self.session = session

    # 实名认证接口
    def realname(self, realname_v, card_id_v):
        url = BASE_HOST + '/member/realname/approverealname'
        info = {'realname': realname_v, 'card_id': card_id_v}
        resp = self.session.post(url=url, data=info, files={'x': 'y'})
        logging.info(f'实名认证:{resp.json()}')
        return resp

    # 开户接口
    def open_account(self):
        url = BASE_HOST + '/trust/trust/register'
        resp = self.session.post(url=url)
        logging.info(f'开户: {resp.json()}')
        return resp

    # 第三方开户接口
    def third_open_account(self, url, info):
        resp = self.session.post(url=url, data=info)
        logging.info(f'第三方开户: {resp.text}')
        return resp
